/*** Eclipse Class Decompiler plugin, copyright (c) 2012 Chao Chen (cnfree2000@hotmail.com) ***/
package com.qihoo.gamecenter.sdk.pay.c;

import android.app.Activity;
import android.text.TextUtils;
import org.json.JSONObject;

public class a extends com.qihoo.gamecenter.sdk.login.plugin.e.b {
    public void a(Activity paramActivity, String paramString) {
        JSONObject localJSONObject1 = new JSONObject();
        Object localObject1;
        try {
            if (!(TextUtils.isEmpty(paramString))) {
                localObject1 = new JSONObject(paramString);
                if (localObject1 != null) {
                    int i = Integer.valueOf(((JSONObject) localObject1).optInt("errno")).intValue();
                    localJSONObject1.put("error_code", i);
                    JSONObject localJSONObject2 = ((JSONObject) localObject1).getJSONObject("data");
                    if ((i == 0) && (localJSONObject2 != null)) {
                        String str1 = localJSONObject2.optString("access_token");
                        String str2 = localJSONObject2.optString("expires_in");
                        JSONObject localJSONObject3 = new JSONObject();
                        localJSONObject3.put("access_token", str1);
                        localJSONObject3.put("expires_in", str2);
                        localJSONObject1.put("data", localJSONObject3);
                        new com.qihoo.gamecenter.sdk.pay.modules.b().a(paramActivity, null, null);
                    }
                    else if (localJSONObject2 == null) {
                        localJSONObject1.put("data", "");
                    }
                    else {
                        localJSONObject1.put("data", localJSONObject2);
                    }
                }
            }
        } catch (Exception localc1) {
            com.qihoo.gamecenter.sdk.pay.k.c.c("LoginBridge", new Object[] { localException.toString() });
        } finally {
            com.qihoo.gamecenter.sdk.common.c localc1;
            com.qihoo.gamecenter.sdk.common.c localc2 = (com.qihoo.gamecenter.sdk.common.c) paramActivity;
            localc2.execCallback(localJSONObject1.toString());
            paramActivity.finish();
        }
    }
}